<HTML><HEAD><TITLE>seed(+Seed)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">Arithmetic</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>seed(+Seed)</H1>
Sets the initial seed Seed for generating random numbers with random/1 or
frandom/1.


<DL>
<DT><EM>Seed</EM></DT>
<DD>Integer.
</DD>
</DL>
<H2>Description</H2>
   Used to initialise the seed which is used for the generation of random
   numbers by random/1 or frandom/1.  Setting the same seed value with
   seed/1 enables the generation of a repeatable random sequence with
   random/1 ie.  pseudo-random number generation.
<P>
   The seed value should be an integer in the range 1 .. 2^31-1.
<P>

<H3>Modes and Determinism</H3><UL>
<LI>seed(+) is det
</UL>
<H3>Exceptions</H3>
<DL>
<DT><EM>(4) instantiation fault </EM>
<DD>Seed is not instantiated.
<DT><EM>(5) type error </EM>
<DD>Seed is instantiated, but not to an integer.
</DL>
<H2>Examples</H2>
<PRE>
Success:
      [eclipse]: repeat, random(S).
      S = 464880439   More? (;)
      S = 285401533   More? (;)
      yes.
      [eclipse]: seed(1), repeat, random(S).
      S = 2078917053   More? (;)
      S = 143302914   More? (;)
      yes.
      [eclipse]: seed(1), repeat, random(S).
      S = 2078917053   More? (;)
      S = 143302914   More? (;)
      yes.



</PRE>
<H2>See Also</H2>
<A HREF="../../kernel/arithmetic/random-1.html">random / 1</A>
</BODY></HTML>
